<?php
require_once '../dao/DocenteDAO.php';
require_once '../dao/AlumnoDAO.php';

class LogonModelo {

	public function validarDocente( $codigo, $clave ){
		try {
			$dao = new DocenteDAO();
			$rec = $dao->consultarDocente($codigo);
			if($rec == null){
				throw new Exception("Docente no existe.");
			}
			if($rec["clave"] != $clave){
				throw new Exception("Docente, Clave incorrecta.");
			}
			return $rec;
		} catch (Exception $e) {
			throw $e;
		}
	}
	
	
	public function validarAlumno( $codigo, $clave ){
		try {
			$dao = new AlumnoDAO();
			$rec = $dao->consultarAlumno($codigo);
			if($rec == null){
				throw new Exception("Alumno no existe.");
			}
			if($rec["clave"] != $clave){
				throw new Exception("Alumno, Clave incorrecta.");
			}
			return $rec;
		} catch (Exception $e) {
			throw $e;
		}
	}


}
?>